package cn.Mmovie.servlet;

import cn.Mmovie.bean.Cinema;
import cn.Mmovie.service.CinemaService;
import cn.Mmovie.service.impl.CinemaServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet(name = "AdminAddAuditoriumServlet", value = "/admin/add_auditorium")
public class AdminAddAuditoriumServlet extends HttpServlet {
    private CinemaService cinemaService = new CinemaServiceImpl();

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        List<Cinema> cinemas = cinemaService.queryAllCinema();
        request.setAttribute("cinemas", cinemas);
        request.getRequestDispatcher("/WEB-INF/page/main/auditorium_add.jsp").forward(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request, response);
    }
}
